/**
 * 
 */
package org.istt.domain.acl;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * @author Huy
 *
 */
@Entity
@Table(name="acl_entry", uniqueConstraints=@UniqueConstraint(columnNames={"acl_object_identity", "ace_order"}))
public class Entry {
	private Long id;
	private Integer order;
	private Integer mask;
	private Boolean granting;
	private Boolean auditSuccess;
	private Boolean auditFailure;
	
	private Sid sid;
	private ObjectIdentity objectIdentity;
	
	public Entry(){
		
	}
	
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	@Column(name="ace_order")
	public Integer getOrder() {
		return order;
	}

	public void setOrder(Integer order) {
		this.order = order;
	}

	public Integer getMask() {
		return mask;
	}

	public void setMask(Integer mask) {
		this.mask = mask;
	}

	public Boolean getGranting() {
		return granting;
	}

	public void setGranting(Boolean granting) {
		this.granting = granting;
	}
	
	@Column(name="audit_success")
	public Boolean getAuditSuccess() {
		return auditSuccess;
	}

	public void setAuditSuccess(Boolean auditSuccess) {
		this.auditSuccess = auditSuccess;
	}
	
	@Column(name ="audit_failure")
	public Boolean getAuditFailure() {
		return auditFailure;
	}

	public void setAuditFailure(Boolean auditFailure) {
		this.auditFailure = auditFailure;
	}
	
	@ManyToOne
	@JoinColumn(name="sid")
	public Sid getSid() {
		return sid;
	}

	public void setSid(Sid sid) {
		this.sid = sid;
	}
	
	@ManyToOne
	@JoinColumn(name="acl_object_identity")
	public ObjectIdentity getObjectIdentity() {
		return objectIdentity;
	}
	
	public void setObjectIdentity(ObjectIdentity objectIdentity) {
		this.objectIdentity = objectIdentity;
	}
}
